//
//  ZBHomeViewController.m
//  ZhiBo
//
//  Created by huangtie on 2017/11/4.
//  Copyright © 2017年 huangtie. All rights reserved.
//

#import "ZBHomeViewController.h"
#import "FSBannerView.h"

@interface ZBHomeViewController ()<UITableViewDelegate,UITableViewDataSource,FSBannerViewDelegate , FSBannerViewDataSource>

@property (nonatomic , strong) UITableView *tableView;

@property (nonatomic , strong) FSBannerView *bannerView;

@end

@implementation ZBHomeViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.title = @"首页";
    
    self.bannerView = [[FSBannerView alloc] init];
    self.bannerView.size = CGSizeMake(SCREEN_WIDTH, FLEXIBLE_WIDTH_55INCH(185));
    self.bannerView.delegate = self;
    self.bannerView.dataSource = self;
    self.bannerView.flippingInterval = 3;
    self.bannerView.pageIndicatorAlignment = FSBannerPageIndicatorAlignmentRight;
    
    self.tableView = [[UITableView alloc] initWithFrame:self.view.bounds];
    self.tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
    self.tableView.delegate = self;
    self.tableView.dataSource = self;
    self.tableView.tableHeaderView = self.bannerView;
    self.tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
    self.tableView.backgroundColor = [UIColor clearColor];
    self.tableView.backgroundView.backgroundColor = [UIColor clearColor];
    self.tableView.tableFooterView = [self footerView];
    [self.view addSubview:self.tableView];
}

- (UIView *)footerView
{
    UIView *view = [[UIView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, 200)];
    UILabel *label = [[UILabel alloc] init];
    label.size = CGSizeMake(view.width - 40, view.height - 40);
    label.centerX = view.width / 2;
    label.centerY = view.height / 2;
    label.font = FONT_NORMAL_14;
    label.textColor = UICOLOR_ARGB(0xff333333);
    label.numberOfLines = -1;
    label.text = @"温馨提示：\n1、主播头像设置请使用本人正面高清照片，建议尺寸750*700，严禁图片模糊、衣着暴露、墨镜头发等遮挡面部；\n2、开播前请整理好妆容，注意发型、穿着、背景、房间光线，调整好自己的状态以及手机直播的角度，严禁光线不足、背景杂乱、裸妆、只漏半脸直播；";
    [view addSubview:label];
    return view;
}

#pragma mark banner_delegate
- (NSInteger)numberOfItemsInBannerView:(FSBannerView *)bannerView
{
    return 1;
}

- (NSURL *)bannerView:(FSBannerView *)bannerView imageURLAtIndex:(NSInteger)index
{
    return nil;
}

- (NSString *)bannerView:(FSBannerView *)bannerView imageNameAtIndex:(NSInteger)index
{
    return @"home_banner";
}

- (void)bannerView:(FSBannerView *)bannerView didSelectItemAtIndex:(NSInteger)index
{

}

#pragma mark DELEGATE-TABLEVIEW
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
    return 0;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    return 0;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    return [[UITableViewCell alloc] init];
}

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
    return CGFLOAT_MIN;
}

- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section
{
    return CGFLOAT_MIN;
}

- (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section
{
    return CGFLOAT_MIN;
}

@end
